<?php
/** 
 * EGP Framework
 *
 * LICENSE
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author     Akon(番茄红了) <aultoale@gmail.com>
 * @copyright  Copyright (c) 2008 (http://www.tblog.com.cn)
 * @license    http://www.gnu.org/licenses/gpl.html     GPL 3
 * @version    v1.0.0 Beta @ 2008-10-16
 */

!defined('EGP_LIB_DIR') && die('Access Deny!');

/**
 * Ext 模型基础类
 *
 * @package    classes
 * @author     Akon(番茄红了) <aultoale@gmail.com>
 * @copyright  Copyright (c) 2008 (http://www.tblog.com.cn)
 * @license    http://www.gnu.org/licenses/gpl.html     GPL 3
 */
class Ext_Model_Abstract
{

    /**
     * 获取到当前的 Controller_Action
     *
     * 请不要轻易在 Model 中调用该方法，该方法只为特殊情况时而存在
     *
     * @return EGP_Controller_Action
     */
    public function getController()
    {
        return EGP_Controller_Front::getInstance()->lastController();
    }

    /**
     * 获取到数据库适配器
     *
     * @return EGP_Db_Adapter_Abstract
     */
    final public function getDb()
    {
        return EGP_Registry::get('db');
    }

    /**
     * 获取到配置数据
     *
     * @return EGP_ArrayObject
     */
    final public function getConfig()
    {
        return EGP_Registry::get('config');
    }

    /**
     * 获取到缓存适配器
     *
     * @return EGP_Cache_Abstract
     */
    final public function getCache()
    {
        return EGP_Registry::get('cache');
    }

}